package com.ningxia.water.mapper;

import com.ningxia.water.entity.ZtAreaInfo;
import com.ningxia.water.entity.ZtCityInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningxia.water.entity.ZtDistrictInfo;
import com.ningxia.water.vo.out.ZoneVo;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hz
 * @since 2021-05-14
 */
public interface ZtCityInfoMapper extends BaseMapper<ZtCityInfo> {

    /**
     * 该市下的所有区县
     * @param id
     * @return
     */
    @Select("select district_id from zt_district_info where city_id = #{id}")
    List<Integer> getAllDistrictIds(Integer id);

    /**
     * 该市下的所有工业园区
     * @param id
     * @return
     */
    @Select("select area_id from zt_area_info where city_id = #{id}")
    List<Integer> getAllAreaIds(Integer id);

    /**
     * 获取该城市下的所有区县
     * @param cityId
     * @return
     */
    @Select("select * from zt_district_info where city_id = #{cityId}")
    List<ZtDistrictInfo> getAllDistrict(Integer cityId);

    /**
     * 获取该城市下的所有工业园区
     * @param cityId
     * @return
     */
    @Select("select * from zt_area_info where city_id = #{cityId}")
    List<ZtAreaInfo> getAllArea(Integer cityId);

    /**
     * 获取城市信息
     * @return
     */
    @Select("select city_id as zoneId,city_name as city from zt_city_info")
    List<ZoneVo> getCityInfos();
}
